<?php
namespace app\demo\controller;

use Env;
use think\Request;
use Session;
use Db;

class Index
{
    public function index(Request $request)
    {

        dump($request->ext());
        dump('hello page!');
	   
   }

    public function responsePage(){

        $data = [
            'name'=>'qiqi',
        ];

        return redirect('/demo/Index/goThatPage');
    }


    public function goThatPage(){


        return response("hi here!");
    }


    public function viewData(){

        $info = Db::table('qi_feedback')->where('id',100)->findOrFail();

        $sql = Db::getLastSql();

        dump($sql);
        dump($info);


    }

    public function addData(){

        $data = [
            'user_name' => 'qiqi',
            'content' => 'Hello '.time(),
            'create_time'=> date('Y-m-d H:i:s'),
            'update_time'=> date('Y-m-d H:i:s'),
        ];
        $result = Db::table('qi_feedback')->insertGetId($data);

        dump($result);

    }


    public function editData(){
        $data = [
            'user_name' => 'qiqi update',
            'content' => 'Hello update '.time(),
            'update_time'=> date('Y-m-d H:i:s'),
        ];
        $result = Db::table('qi_feedback')->where('id',8)->update($data);

        dump($result);

    }

    public function delData(Request $request){

        $id = $request->param('id');

        $result = Db::table('qi_feedback')->where('id',$id)->delete();

        dump($result);
    }

   public function _empty(){
	   dump("hi this is a empty page!");
   }
   

}
